const cartModel = require('../../model/mall/shoppingcart')

async function add(req, res) {
    const result = await cartModel.add(req.body);
    const json = {
        code: result.code,
        message: result.msg,
        data:result.data
    }
    res.send(json)
}
async function select(req, res) {
    
    const result = await cartModel.select(req.query.userID);
    const json = {
        code: result.code,
        message: result.msg,
        data:result.data
    }
    res.send(json)
}
async function update(req, res) {
    
    const result = await cartModel.update(req.body);
    const json = {
        code: result.code,
        message: result.msg,
    }
    res.send(json)
}
async function del(req, res) {
    
    const result = await cartModel.del(req.body);
    const json = {
        code: result.code,
        message: result.msg,
    }
    res.send(json)
}
module.exports = {
    add,
    select,
    update,
    del
}